package com.ruoyi.web.controller.client.runjianhr;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.client.runjianhr.bean.HREmployee;
import com.ruoyi.client.runjianhr.service.HREmployeeService;
import com.ruoyi.common.core.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.client.cloudcc.api.FormApiService;
import com.ruoyi.client.cloudcc.bean.QueryParam;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * 人员管理
 */
@Controller
@RequestMapping("/HREmployee/")
public class HREmployeeController extends BaseController {

    @Resource
    HREmployeeService employeeService;
    @Resource
    FormApiService formApiService;

    /**
     * 获取润建员工列表
     * @return  返回员工列表
     */
    @RequestMapping("getEmployeeList")
    @ResponseBody
    public List<HREmployee.data> getEmployeeList(){
        List<HREmployee.data> employeeList = new ArrayList<>();
        try {
            employeeList = employeeService.getEmployeeList();
            return employeeList;
        } catch (Exception e) {
            e.printStackTrace();
            return employeeList;
        }
    }

    @RequestMapping("initUser")
    @ResponseBody
    public String initUser() throws Exception {
        JSONObject jsonObject = formApiService.cquery(new QueryParam("ccuser"));
        System.out.println(jsonObject);
        return jsonObject.toString();
    }

}
